<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
/*
	获得天气
*/
defined('BY_JYA') or exit('error');
$location=$_RQ['location'];
$type=$_RQ['type']?:'now';
$setting=$this->get_setting();
$setting['hefeng_key']=$setting['hefeng_key']?:'023788fdbff4436a8825510d52eaf0eb';
$setting['baidu_key']=$setting['baidu_key']?:'5slgyqGDENN7Sy7pw29IUvrZ';
if($setting['type']==2){
	$url = "https://api.map.baidu.com/telematics/v3/weather?output=json&location=".$location."&key=".$setting['baidu_key'];
}else{
	$url = "https://free-api.heweather.net/s6/weather/".$type."?location=".$location."&key=".$setting['hefeng_key'];
}
$data = cfc('http')->ihttp_request($url);
$content=$data['content'];
$content=json_decode($content,true);
if($setting['type']==2){
	$weather=$content['HeWeather6'][0]['now'];
}else{
	$weather=$content['HeWeather6'][0]['now'];
}

exi($weather);